package com.lly.bigdata.bgayx.vo;/**
 * Created by Administrator on 2019/7/22 0022.
 */

import org.springframework.http.HttpStatus;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Administrator
 * @description
 * @date 2019/7/22 0022
 **/
public class AjaxResultList<T> {
    private Long pages;
    private Long page;
    /**
     * 返回数据
     */
    private List<T> rows = new ArrayList<T>();

    private Long total;
    private int code;
    private String message;
    private Object data;

    public AjaxResultList() {

    }

    public static AjaxResultList ok() {
        AjaxResultList resultList = new AjaxResultList();
        resultList.setCode(HttpStatus.OK.value());
        return resultList;
    }

    public static AjaxResultList error(String mesg) {
        AjaxResultList resultList = new AjaxResultList();
        resultList.setCode(HttpStatus.OK.value());
        return resultList;
    }

    public static AjaxResultList page(List rs) {
        AjaxResultList resultList = new AjaxResultList();
        resultList.setCode(HttpStatus.OK.value());
        resultList.setRows(rs);
        return resultList;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Long getPages() {
        return pages;
    }

    public void setPages(Long pages) {
        this.pages = pages;
    }

    public Long getPage() {
        return page;
    }

    public void setPage(Long page) {
        this.page = page;
    }

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }
}
